package com.beauty.entity.security;

// default package
// Generated 2015-7-19 19:51:33 by Hibernate Tools 4.3.1

//import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * Home object for domain model class BeautyAuthorityResource.
 * @see .BeautyAuthorityResource
 * @author Hibernate Tools
 */
//@Stateless
public class BeautyAuthorityResourceHome {

	private static final Log log = LogFactory.getLog(BeautyAuthorityResourceHome.class);

	@PersistenceContext
	private EntityManager entityManager;

	public void persist(BeautyAuthorityResource transientInstance) {
		log.debug("persisting BeautyAuthorityResource instance");
		try {
			entityManager.persist(transientInstance);
			log.debug("persist successful");
		} catch (RuntimeException re) {
			log.error("persist failed", re);
			throw re;
		}
	}

	public void remove(BeautyAuthorityResource persistentInstance) {
		log.debug("removing BeautyAuthorityResource instance");
		try {
			entityManager.remove(persistentInstance);
			log.debug("remove successful");
		} catch (RuntimeException re) {
			log.error("remove failed", re);
			throw re;
		}
	}

	public BeautyAuthorityResource merge(BeautyAuthorityResource detachedInstance) {
		log.debug("merging BeautyAuthorityResource instance");
		try {
			BeautyAuthorityResource result = entityManager.merge(detachedInstance);
			log.debug("merge successful");
			return result;
		} catch (RuntimeException re) {
			log.error("merge failed", re);
			throw re;
		}
	}

	public BeautyAuthorityResource findById(Long id) {
		log.debug("getting BeautyAuthorityResource instance with id: " + id);
		try {
			BeautyAuthorityResource instance = entityManager.find(BeautyAuthorityResource.class, id);
			log.debug("get successful");
			return instance;
		} catch (RuntimeException re) {
			log.error("get failed", re);
			throw re;
		}
	}
}
